function [] = testCurvature( file, name )
addpath(genpath('../export'));addpath(genpath('../obj-tools'));
addpath(genpath('../util'));addpath(genpath('../color'));
addpath(genpath('../experiments'));
resDir = '../../res/';
[data] = load([resDir name '/' file]);
numberOfFrames = size( data.frames, 1 );

topology = data.topology;
% Number of vertices
n = size( toMatrix( data.frames(1,:) ), 1);
numberOfFrames = 2;
gaussCurvature = zeros(n, numberOfFrames);
deltaCurvature = zeros(n, numberOfFrames);

%horseRef = load('horseRef.mat');
% refCurv = meshCurvature(topology, horseRef.horseRef);
geometry = toMatrix( data.frames(1,:) );
refCurv = meshCurvature(topology, geometry);
k(:, 1) = ( refCurv.k1 ./ refCurv.k2);
%k(:, 1) = refCurv.k1;

%
for frameIndex = 1:numberOfFrames
    geometry = toMatrix( data.frames(frameIndex,:) );
    curvature = meshCurvature(topology, geometry);
    gaussCurvature(:, frameIndex) = ( curvature.k1 .* curvature.k2 );
    %gaussCurvature(:, frameIndex) = curvature.k1;
end % for

%{
for i = 1:n
    kRef = k(i,1);
    deltaCurvature(i, :) = abs( gaussCurvature(i, 1:numberOfFrames) - kRef );
end % for

meanCurv = zeros(n, 1); 
for i = 1:n
    meanCurv(i, 1) = sum( deltaCurvature(i, :) ) / 2;
end % for
finalMeanCurv = zeros(n,1);
finalMeanCurv(:,1) = meanCurv(:,1);
%}


geometry = toMatrix( data.frames(1,:) );
%ref = load('horseRef.mat');
%geometry = ref.horseRef;
geometry = toMatrix( data.frames(1,:) );
colors = colorForField( gaussCurvature(:,1), -2 );
exportPLY([name 'MeanCurv.ply'], geometry, colors, topology, 0);

end % function

